


<!DOCTYPE html>
<html>
<head>
  <title>添加管理</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" th:href="@{/bootstrap4/css/bootstrap.min.css}">
  <link rel="stylesheet" th:href="@{/css2/style2.css}"> 
  <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
  <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
  <script th:src="@{/js2/my.js}"></script>
</head>

<script type="text/javascript">
var int=self.setInterval("weithting()",1000);
  
function weithting() {
	 
  var value="0100";
  var equipment = $("#equipment").val();
  var commandType =  3;
  var ass="commandMesg="+value+"&commandId=" +"&commandName="+ equipment+"&commandType="+ commandType;
  console.log(ass);
  $.ajax({
      //几个参数需要注意一下
          type: "POST",//方法类型
          dataType: "json",//预期服务器返回的数据类型
          url: "sendEquipmentResult" ,//url
          data: ass,
          success: function (result) { 
              console.log(result);//打印服务端返回的数据(调试用)
              $("#txtid").html(result.data); 
              $("#weightings").val(result.data); 
              
          },
          error : function() {
              alert("异常！");
          }
      });
} 


function submitComm() {
  var equipment = $("#equipment").val();
  var weightings = $("#weightings").val();
  var commandType =  3;
  var ass="command="+equipment +"&weightings="+ weightings;
  console.log(ass);
  $.ajax({
      //几个参数需要注意一下
          type: "POST",//方法类型
          dataType: "json",//预期服务器返回的数据类型
          url: "weightInfo/saveWeightInfoing" ,//url
          data: ass,
          success: function (result) { 
              console.log(result);//打印服务端返回的数据(调试用)
              
              $("#messageid").html('&nbsp;&nbsp;' + result.msg); 
              setTimeout(function(){ $("#messageid").html("")} , 5000 ); 
          },
          error : function() {
              alert("异常！");
          }
      });
} 
</script>
  <style type="text/css">

	
   </style>
 
<body>
<div class="header-area" id="headerArea">
   <div class="container h-100 d-flex align-items-center justify-content-between">
 
     <div class="logo-wrapper">
     <a th:href="@{/timeWeight}"> 返回 </a>
	 </div>
     <!-- Search Form-->
     <div class="top-search-form">
     	实时称重
     </div>
     <div  id="suhaNavbarToggler"><span></span><span></span><span></span></div>
   </div>
 </div>

<div class="container mt60" >
  <form id="formID"  >
	<input type="hidden" id="equipment" name="equipment" th:value="${equipment}" /> 
	<input type="hidden" id="commandid" name="commandid" th:value="${commandid}" /> 
	<input type="hidden" id="weightings" name="weightings" th:value="${weightings}" />       
	<div class="wrapper mt90">
	    <div class="cell">
	        <p id="txtid"> </p>
	    </div>
	</div>
	
	<div class="mt90">
	<button type="button" class="btn btn-primary btn-block fs30" onclick="submitComm();">保存</button>
	</div>
   <div id="messageid" class="fl clred pl10"> 
      </div>
  </form>
</div>

</body>
</html>
   